<template>
  <PageWrapper :sidebarWidth="220">
    <template #sidebar>
      <BasicTree
        :title="t('版本历史')"
        :search="true"
        :toolbar="true"
        :showIcon="true"
        :api="resTreeData"
        :params="{ isShowDrag: '0', quesId: props.quesId }"
        :immediate="immediate"
        :defaultExpandLevel="1"
        @select="handleSelect"
      />
    </template>
    <ViewsQuesLibResViewForm :id="id" />
  </PageWrapper>
</template>
<script lang="ts">
  export default defineComponent({
    name: 'ViewsQuesLibResIndex',
  });
</script>
<script lang="ts" setup>
  import { onMounted, ref, watch, defineComponent } from 'vue';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { PageWrapper } from '/@/components/Page';
  import { BasicTree } from '/@/components/Tree';
  import { resTreeData } from '/@/api/quesLib/res/queslibRes';
  import ViewsQuesLibResViewForm from './viewForm.vue';
  const props = defineProps({
    quesId: String,
  });
  const { t } = useI18n('sys.empUser');
  const id = ref<string>('');
  const immediate = ref(false);
  watch(
    () => props.quesId,
    async () => {
      console.log(props.quesId);
    },
  );
  onMounted(async () => {
    immediate.value = true;
  });
  function handleSelect(keys: string[], { node }) {
    id.value = node.id;
  }
</script>
